import {Controller} from "../../server/web/_Controller"
import {Component} from "../../server/support/anno/Component"
import {RequestMapping} from "../../server/support/anno/RequestMapping"


@Component()
class ReturnValueController extends Controller{

  @RequestMapping("/testString")
  testString() {
    return "hehe"
  }

  @RequestMapping("/testJson")
  testJson() {
    return {
      name: "wang"
    }
  }

  @RequestMapping("/redirect")
  redirect(req: HttpRequest, res: HttpResponse) {
    res.sendRedirect(req.params.url || "/testJson")
  }

  @RequestMapping("/forward")
  forward(req, res: HttpResponse) {
    res.forward("/testJson")
  }
}
